<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/WEB-INF/templates/basic_template.xhtml">
	<ui:define name="content">
		<h:form>
			<br />
			<p:fieldset legend="Cadastro de usuário">
			<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="3">
				<h:outputText value="Login:" />
				<p:inputText value="#{userMBean.user.login}" required="true" label="Login" />
				
				<h:outputText value="Nome:" />
				<p:inputText value="#{userMBean.user.name}" required="true" label="Nome" />

				<h:outputText value="Senha:" />
				<p:password value="#{userMBean.user.passwd}" required="true" label="Senha" />

				<h:outputText value="Repita a senha:" />
				<p:password value="#{userMBean.auxPasswd}" required="true" label="Confirmação da senha" />

				<h:outputText value="Email:" />
				<p:inputText value="#{userMBean.user.email}" required="true" label="Email" />
				</h:panelGrid>

				<h:panelGrid columns="3" style="margin-bottom:7px" cellpadding="3">
					<h:outputText value="Permissão: " />
					<p:selectOneRadio id="options" value="#{userMBean.user.role}"
						required="true" label="Permissão">
						<f:selectItem itemLabel="Padrão" itemValue="USUARIO" />
						<f:selectItem itemLabel="Administrador" itemValue="ADMIN" />
					</p:selectOneRadio>
				</h:panelGrid>
				<br />

				<p:commandButton onclick="history.back()" value="Voltar" />
				<p:commandButton action="#{userMBean.cadastrarUsuario}" value="Cadastrar" />
			</p:fieldset>

		</h:form>
	</ui:define>
</ui:decorate>
</html>